from tortoise import fields
from app.models.base.base import BaseModel

class Pet(BaseModel):
    """宠物管理模型"""
    name = fields.CharField(max_length=50, description="宠物姓名")
    type = fields.CharField(max_length=20, description="宠物类型")  # dog, cat, bird, fish, rabbit, other
    breed = fields.CharField(max_length=50, null=True, description="品种")
    age = fields.FloatField(description="年龄(岁)")
    gender = fields.CharField(max_length=10, description="性别")  # male, female
    health_status = fields.CharField(max_length=20, description="健康状态")  # healthy, need_attention, under_treatment
    vaccine_status = fields.CharField(max_length=20, description="疫苗情况")  # vaccinated, pending, not_vaccinated
    last_checkup = fields.DatetimeField(null=True, description="上次体检时间")
    total_expense = fields.FloatField(default=0.0, description="累计医疗花销(元)")
    notes = fields.TextField(null=True, description="备注信息")
    
    # 关联字段
    user = fields.ForeignKeyField('models.User', related_name='pets')
    family = fields.ForeignKeyField('models.Family', related_name='pets')
    
    class Meta:
        table = "family_pets"
        table_description = "家庭宠物管理表"